import Vue from 'vue'
import Vuex from 'vuex'
import cartModule from './cart.js'
import userInfo from './userInfo.js'
Vue.use(Vuex)
import createPersistedState from "vuex-persistedstate";
//用来全局数据管理
const store = new Vuex.Store({
	state: {a:10},
	modules: {
		cartModule,userInfo
	},
	plugins: [
		createPersistedState({
			storage: {
				getItem: (key) => uni.getStorageSync(key),
				setItem: (key, value) => uni.setStorageSync(key, value),
				removeItem: (key) => uni.removeStorageSync(key),
			},
		}),
	],
})

export default store
